package dto

import "service/app/mode"

// type MenusAdd struct {
// 	Name      string `json:"name" form:"name" binding:"required" required_msg:" name 为必填项目" validate:"required"`
// 	Web_name  string `json:"web_name" form:"web_name" binding:"required" required_msg:" web_name 为必填项目" validate:"required"`
// 	Path      string `json:"path" form:"path" binding:"required" required_msg:" path 为必填项目" validate:"required"`
// 	Pattern   int    `json:"pattern" form:"pattern" binding:"required" required_msg:" pattern 为必填项目" validate:"required"`
// 	Order_num int    `json:"order_num" form:"order_num" binding:"required" required_msg:" order_num 为必填项目" validate:"required"`
// 	Pid       int    `json:"pid" form:"pid" binding:"required" required_msg:" pid 为必填项目" validate:"required"`
// 	Level     int    `json:"level" form:"level" binding:"required" required_msg:" level 为必填项目" validate:"required"`
// }

type Imenulist_Add struct {
	Menus []ImenusAdd `json:"menus"  binding:"required" required_msg:" menus 为必填项目"`
}

type ImenuList_updata struct {
	Menus []int `json:"menus"  binding:"required" required_msg:" menus 为 []int,必填项目"`
}

type Imenu_updata struct {
	Id        uint   `json:"id"  form:"id" binding:"required" required_msg:"id为必填项目"`
	Name      string `json:"name" form:"name" binding:"required" required_msg:" name 为必填项目" validate:"required"`
	Api_id    int    `json:"api_id" form:"Api_id"`
	Perm      string `json:"perm" form:"perm" binding:"required" required_msg:" Perm 为必填项目" validate:"required"`
	Pattern   int    `json:"pattern" form:"pattern" binding:"required" required_msg:" Pattern 为必填项目" validate:"required"`
	Order_num int    `json:"order_num" form:"order_num" binding:"required" required_msg:" order_num 为必填项目" validate:"required"`
	Pid       int    `json:"pid" form:"pid" binding:"required" required_msg:" pid 为必填项目" validate:"required"`
	Level     int    `json:"level" form:"level" binding:"required" required_msg:" level 为必填项目" validate:"required"`
	Path      string `json:"path" form:"path"  binding:"required" required_msg:" path 为必填项目" validate:"required"`
}

type ImenusAdd struct {
	Name      string `json:"name" form:"name" binding:"required" required_msg:" name 为必填项目" validate:"required"`
	Api_id    int    `json:"Api_id" form:"Api_id"`
	Perm      string `json:"perm" form:"perm" binding:"required" required_msg:" Perm 为必填项目" validate:"required"`
	Pattern   int    `json:"pattern" form:"pattern" binding:"required" required_msg:" Pattern 为必填项目" validate:"required"`
	Order_num int    `json:"order_num" form:"order_num" binding:"required" required_msg:" order_num 为必填项目" validate:"required"`
	Pid       int    `json:"pid" form:"pid" binding:"required" required_msg:" pid 为必填项目" validate:"required"`
	Level     int    `json:"level" form:"level" binding:"required" required_msg:" level 为必填项目" validate:"required"`
	Path      string `json:"path" form:"path"`
	// Api_id    int    `json:"Api_id" form:"Api_id" binding:"required" required_msg:" Api_id 为必填项目" validate:"required"`
	// Hidden    int8   `json:"hidden" form:"hidden" binding:"required" required_msg:" hidden 为必填项目" validate:"required"`
}

func (m *ImenusAdd) ConverMenuAdd(param *ImenusAdd) *mode.Db_menu {
	var newMenu mode.Db_menu
	newMenu.Name = param.Name
	newMenu.Perm = param.Perm
	newMenu.Pattern = param.Pattern
	newMenu.Order_Num = param.Order_num
	newMenu.Pid = param.Pid
	newMenu.Level = param.Level
	// m.Hidden = param.Hidden
	newMenu.Path = param.Path
	newMenu.Api_id = 0
	return &newMenu
}
